package org.iweb.html.impl.js.state;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.iweb.html.impl.js.State;

public class ElementState implements Serializable{

	private String id;	
	private List<State> states;
	
	public ElementState(String id) {
		this.id=id;
		states=new ArrayList<State>();
	}
	
	public void setId(String id) {
		this.id = id;
	}
	public String getId() {
		return id;
	}
	public void setStates(List<State> states) {
		this.states = states;
	}
	public List<State> getStates() {
		return states;
	}
	
	public void addState(State state){
		int i=0;
		for(i=0;i<getStates().size();i++){
			if(getStates().get(i).getName().equalsIgnoreCase(state.getName())){
				getStates().remove(i);
				//getStates().add(i,state);
				//return;
				break;
			}
		}
		
		getStates().add(i,state);
	}
	
}
